package com.comven.example.srouce.config;

import com.comven.example.srouce.util.DataSourceContextHodler;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @author: xiongxin
 * @create: 2022/9/23 17:03
 * @desc: 重写数据源发送类 指定key值
*/

public class DynamicDataSourceHodler extends AbstractRoutingDataSource{

	/* (non-Javadoc)
	 * @see org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource#determineCurrentLookupKey()
	 */
	@Override
	protected Object determineCurrentLookupKey() {

		return DataSourceContextHodler.getContextKey();
	}

}
